-
-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A non-numeric value encountered in Stacktrace.php #816
Conversation
It would be cool if you could share a little script reproducing the problem of if you can debug and tell us what's the value of the |
@ste93cry That's my state before exception: $argument = "???"
$index = "container"
$maxValueLength = 1024
$frame = Array
(
[function] => "Illuminate\Container\{closure}"
[type] => "->"
[class] => "Illuminate\Foundation\Application"
[file] => "/var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php"
[line] => 776
[args] => Array
(
[container] => "???"
[parameters] => "???"
)
) That happends when I make some Fatal error. See my example:
|
Are you using XDebug or some other debug extension? If so, can you try disabling it and retrying? |
@ste93cry Yeah, I have XDebug in my project. When I disabled it, the error disappeared. |
@@ -311,7 +311,7 @@ protected function getFrameArgumentsValues(array $frame): array | |||
$result = array_map([$this, 'serializeArgument'], $frame['args']); | |||
} else { | |||
foreach (array_values($frame['args']) as $index => $argument) { | |||
$result['param' . ($index + 1)] = $this->serializeArgument($argument); | |||
$result['param' . ((int)$index + 1)] = $this->serializeArgument($argument); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the culprit of the problem as we found out is XDebug. The error occurs because it changes how the arguments of a stacktrace frame are reported by using the argument name as key of each value of the $args
variable instead of its 0-based position in the function signature. Blindly casting $index
to an integer
then would result in some indesiderate results (e.g. foo
would be converted to 0
). The best fix we can do is to check whether the $index
variable is a string
or an integer
and act accordingly. However, this exact same issue should have been fixed in #761 which is the reason why there is an if
/else
statement wrapping the loop, so I don't get why it happens and it would be cool if you could debug a bit more in depth to see what's happening
The screenshot you provided does not contain the fix by #763, could you make sure you are using the latest version of the library and see if the issue is still there? |
Good catch, I didn’t even noticed it! |
I'm going to update dependency on Monday and check the result |
@ste93cry Sorry for delay. I updated dependencies and now all works fine. I have the next versions: Ticket going to be closed. |
I get string $index and observe "A non-numeric value encountered" error
Please, take a look at my solution. I'm not sure that this is correct fix and the root of the problem